package com.bawei.composeui2207a.day02

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.bawei.composeui2207a.R

/**
 * 作者：赵亮
 * 时间：2024/12/11 11:04
 * 功能：Box 布局中所有子组件会从左上角开始堆叠在一起。
 */
@Composable
fun Page6() {
    Box(
        modifier = Modifier
            .background(color = Color.Red)
            .fillMaxSize()
    ) {

        // 第一张图片
        Image(
            modifier = Modifier
                .align(Alignment.Center)
                .size(50.dp),
            painter = painterResource(id = R.drawable.profile_picture),
            contentDescription = null
        )

        // 第二张图片
        Image(
            modifier = Modifier.size(50.dp),
            painter = painterResource(id = R.drawable.profile_picture),
            contentDescription = null
        )

        Image(
            modifier = Modifier.size(50.dp).align(Alignment.TopCenter),
            painter = painterResource(id = R.drawable.profile_picture),
            contentDescription = null
        )

        Image(
            modifier = Modifier.size(50.dp).align(Alignment.TopEnd),
            painter = painterResource(id = R.drawable.profile_picture),
            contentDescription = null
        )
        Image(
            modifier = Modifier.size(50.dp).align(Alignment.CenterStart),
            painter = painterResource(id = R.drawable.profile_picture),
            contentDescription = null
        )

        Image(
            modifier = Modifier.size(50.dp).align(Alignment.BottomEnd),
            painter = painterResource(id = R.drawable.profile_picture),
            contentDescription = null
        )


    }
}

@Preview(showSystemUi = true)
@Composable
fun Page6Preview() {
    Page6()
}

